﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Ebusiness_UserService.Migrations
{
    /// <inheritdoc />
    public partial class project2 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_T_User_T_UserAccessFail_userAccessFailId",
                table: "T_User");

            migrationBuilder.DropIndex(
                name: "IX_T_User_userAccessFailId",
                table: "T_User");

            migrationBuilder.DropColumn(
                name: "userAccessFailId",
                table: "T_User");

            migrationBuilder.CreateIndex(
                name: "IX_T_UserAccessFail_Userld",
                table: "T_UserAccessFail",
                column: "Userld",
                unique: true);

            migrationBuilder.AddForeignKey(
                name: "FK_T_UserAccessFail_T_User_Userld",
                table: "T_UserAccessFail",
                column: "Userld",
                principalTable: "T_User",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_T_UserAccessFail_T_User_Userld",
                table: "T_UserAccessFail");

            migrationBuilder.DropIndex(
                name: "IX_T_UserAccessFail_Userld",
                table: "T_UserAccessFail");

            migrationBuilder.AddColumn<Guid>(
                name: "userAccessFailId",
                table: "T_User",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.CreateIndex(
                name: "IX_T_User_userAccessFailId",
                table: "T_User",
                column: "userAccessFailId");

            migrationBuilder.AddForeignKey(
                name: "FK_T_User_T_UserAccessFail_userAccessFailId",
                table: "T_User",
                column: "userAccessFailId",
                principalTable: "T_UserAccessFail",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
